﻿<UserControl x:Class="CodeSHARPer.View.Tools.WorkingFolderView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:views="clr-namespace:CodeSHARPer.View"
             xmlns:cinch="clr-namespace:Cinch;assembly=Cinch.WPF"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <TextBox Text="{Binding FilterString, UpdateSourceTrigger=PropertyChanged}" Grid.Row="0"/>
        <views:FolderBrowseTreeView x:Name="tree" ItemsSource="{Binding Items}" Grid.Row="1" >
            <views:FolderBrowseTreeView.ContextMenu>
                <ContextMenu>
                    <MenuItem Header="ReScan folder" Command="{Binding ReScanFolderCommand}"/>
                </ContextMenu>
            </views:FolderBrowseTreeView.ContextMenu>
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseDoubleClick">
                    <cinch:EventToCommandTrigger 
                        Command="{Binding OpenFileFromTreeCommand}" CommandParameter="{Binding ElementName=tree,Path=SelectedValue}"/>
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </views:FolderBrowseTreeView>
    </Grid>
</UserControl>
